home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / boiler_b.swf / scripts / DefineSprite_312 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  1.8 KB  |  91 lines

  1. var pEnergy;
  2. var pTeaTime;
  3. var pBonus;
  4. var pBonusAnim;
  5. this.setHint = function(str)
  6. {
  7.    this.hint_txt.text = str;
  8. };
  9. this.addScore = function(num)
  10. {
  11.    _global.gSC += num;
  12.    this.score_mc.setNum(_global.gSC);
  13. };
  14. this.teaBreak = function()
  15. {
  16.    var _loc2_ = this;
  17.    _loc2_._parent.snd_mc.playsound("pKettle");
  18.    pTeaTime = 1;
  19.    var _loc1_ = 0;
  20.    while(_loc1_ < 5)
  21.    {
  22.       _loc2_._parent["cowboy" + _loc1_ + "_mc"].teaBreak();
  23.       _loc1_ = _loc1_ + 1;
  24.    }
  25. };
  26. this.teaBreakOver = function()
  27. {
  28.    pTeaTime = 0;
  29. };
  30. this.decreaseEnergy = function(tx)
  31. {
  32.    pEnergy -= tx;
  33.    if(pEnergy <= 0)
  34.    {
  35.       pEnergy = 0;
  36.       this._parent.gameOver("lose");
  37.    }
  38.    this.energybar_mc.gotoAndStop(pEnergy + 5);
  39. };
  40. this.increaseEnergy = function(tx)
  41. {
  42.    pEnergy += tx;
  43.    if(pEnergy >= 100)
  44.    {
  45.       pEnergy = 100;
  46.    }
  47.    this.energybar_mc.gotoAndStop(pEnergy + 5);
  48. };
  49. this.onEnterFrame = function()
  50. {
  51.    pBonusAnim[0] = pBonusAnim[0] + 1;
  52.    if(pBonusAnim[0] == 3)
  53.    {
  54.       pBonus--;
  55.       pBonusAnim[1] = pBonusAnim[1] + 1;
  56.       pBonusAnim[0] = 0;
  57.       if(pBonusAnim[1] == 10)
  58.       {
  59.          if(pBonus < 0)
  60.          {
  61.             pBonus = 0;
  62.             this.blurnum_mc._y = -50;
  63.          }
  64.          this.timer_mc.setNum(pBonus + "00");
  65.          pBonusAnim[1] = 0;
  66.       }
  67.    }
  68. };
  69. this.addTarget = function()
  70. {
  71.    var _loc2_ = this;
  72.    var _loc3_ = Math.floor(Math.random() * 99);
  73.    var _loc1_ = pBonus * 100 + _loc3_;
  74.    _loc2_.addScore(_loc1_);
  75.    pBonus = 1000;
  76.    pBonusAnim[0] = 0;
  77.    pBonusAnim[1] = 0;
  78.    _loc2_.timer_mc.setNum("99900");
  79.    _loc2_.blurnum_mc._y = 4;
  80. };
  81. this.init = function()
  82. {
  83.    var _loc1_ = this;
  84.    _global.gSC = 0;
  85.    _loc1_.pEnergy = 100;
  86.    _loc1_.pTeaTime = 0;
  87.    _loc1_.pBonus = 1000;
  88.    _loc1_.pBonusAnim = Array(0,0);
  89. };
  90. this.init();
  91.